//
// Created by xgz on 10/15/21.
//

#include "thread.hpp"
#include "os.hpp"

void Thread::run() {
    assert(false, "ShouldNotReachHere");
}

void *Thread::allocate(size_t size, bool throw_excpt, MEMFLAGS flags) {
    return malloc(size);
}

void Thread::operator delete(void *p) {
    free(p);
}

void Thread::start(Thread *thread) {
    OS::start_thread(thread);
}

JavaThread::JavaThread(ThreadFunction entry_point, size_t stackSize) {
    OS::create_thread(this, ThreadType::java_thread, stackSize);
    _entry_point = entry_point;
}

JavaThread::JavaThread(ThreadFunction entry_point) {
    OS::create_thread(this, ThreadType::java_thread, 64 * 1024);
    _entry_point = entry_point;
}

void JavaThread::start() {

}
